using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using MemberMgr.Data.BusinessObjects;
using MemberMgr.Data.Base;

namespace MemberMgr.Data.ManagerObjects
{
    public partial interface ItConsumptionDetailManager : IManagerBase<tConsumptionDetail, uint>
    {
		// Get Methods
		IList<tConsumptionDetail> GetByCONSUMPTIONID(System.UInt32 tConsumptionMaster);
		IList<tConsumptionDetail> GetByPRODUCTID(System.UInt32 tProduct);
    }

    partial class tConsumptionDetailManager : ManagerBase<tConsumptionDetail, uint>, ItConsumptionDetailManager
    {
		#region Constructors
		
		public tConsumptionDetailManager() : base()
        {
        }
        public tConsumptionDetailManager(INHibernateSession session) : base(session)
        {
        }
		
		#endregion
		
        #region Get Methods

		
		public IList<tConsumptionDetail> GetByCONSUMPTIONID(System.UInt32 tConsumptionMaster)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(tConsumptionDetail));
			
			
			ICriteria tConsumptionMasterCriteria = criteria.CreateCriteria("TConsumptionMaster");
            tConsumptionMasterCriteria.Add(NHibernate.Criterion.Expression.Eq("Id", tConsumptionMaster));
			
			return criteria.List<tConsumptionDetail>();
        }
		
		public IList<tConsumptionDetail> GetByPRODUCTID(System.UInt32 tProduct)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(tConsumptionDetail));
			
			
			ICriteria tProductCriteria = criteria.CreateCriteria("TProduct");
            tProductCriteria.Add(NHibernate.Criterion.Expression.Eq("Id", tProduct));
			
			return criteria.List<tConsumptionDetail>();
        }
		
		#endregion
    }
}